package org.ruanjj.designmodel.proxymodel;


import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class LogInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        System.out.println("开始调用方法" + method.getName());
        Object result = methodProxy.invokeSuper(obj,args);
        System.out.println(method.getName() + "方法调用结束");
        return result;
    }
}

